package com.easylive.entity.constants;

/**
 * @Author: yudaxian
 * @Description: 常量类
 * @DateTime: 2024/10/16 22:57
 **/
public class Constants {
    /**
     * 项目 Redis key前缀
     */
    public static final String REDIS_KEY_PREFIX = "easylive:";

    // ----------------------------前缀

    public static final String REDIS_KEY_CATEGORY_LIST = REDIS_KEY_PREFIX + "category:list:";

    public static final String REDIS_KEY_PRE_UPLOAD_VIDEO = REDIS_KEY_PREFIX + "uploading:";

    public static final String REDIS_KEY_SYS_SETTING = REDIS_KEY_PREFIX + "sysSetting:";

    public static final String REDIS_KEY_SEARCH_KEYWORD_COUNT = REDIS_KEY_PREFIX + "video:search:";

    public static final String REDIS_KEY_VIDEO_PLAY_COUNT = REDIS_KEY_PREFIX + "video:playcount:";

    /**
     * redis 删除消息队列key
     */
    public static final String REDIS_KEY_FILE_DEL = REDIS_KEY_PREFIX + "queue:del:";

    /**
     * redis 添加文件队列key，永不过期
     */
    public static final String REDIS_KEY_FILE_ADD = REDIS_KEY_PREFIX + "queue:transfer:";

    public static final String REDIS_KEY_QUEUE_PLAY = REDIS_KEY_PREFIX + "queue:video:play:";

    public static final String FILE_FOLDER = "/file/";

    public static final String FILE_VIDEO = "video/";

    public static final String FILE_COVER = "cover/";

    public static final String FILE_TEMP = "temp/";

    public static final String IMAGE_THUMBNAIL_SUFFIX = "_thumbnail.jpg";

    /**
     * 临时视频文件名
     */
    public static final String TEMP_VIDEO_NAME = "/temp.mp4";

    public static final String VIDEO_TEMP_FILE_SUFFIX = "_temp";

    public static final String VIDEO_CODE_HEVC = "hevc";

    public static final String TS_NAME = "index.ts";

    public static final String M3U8_NAME = "index.m3u8";

    /**
     * 验证码key
     */
    public static final String REDIS_KEY_CHECK_CODE = REDIS_KEY_PREFIX + "checkcode:";

    // ----------------------------token
    public static final String REDIS_KEY_TOKEN_WEB = REDIS_KEY_PREFIX + "token:web:";

    public static final String REDIS_KEY_TOKEN_ADMIN = REDIS_KEY_PREFIX + "token:admin:";

    public static final String COOKIE_TOKEN_WEB = "token";

    public static final String COOKIE_TOKEN_ADMIN = "adminToken";

    // ----------------------------时间（毫秒）
    public static final Integer REDIS_KEY_EXPIRES_ONE_SECOND = 1000;

    /**
     * 时间单位：60秒 （毫秒）
     */
    public static final Integer REDIS_KEY_EXPIRES_ONE_MINUTE = 1000 * 60;

    public static final Long REDIS_KEY_EXPIRES_ONE_DAY = 1000 * 60 * 60 * 24L;

    public static final Integer TIME_SECONDS_ONE_DAY = 60 * 60 * 24;

    public static final Integer TIME_HOUR_24 = 24;


    // ----------------------------初始硬币
    public static final Integer INITIAL_COINS = 10;

    // ----------------------------数字
    public static final Integer ZERO = 0;

    public static final Integer ONE = 1;

    public static final Integer LENGTH_2 = 2;

    public static final Integer LENGTH_10 = 10;

    public static final Integer LENGTH_15 = 15;

    public static final Integer LENGTH_20 = 20;

    public static final Integer LENGTH_30 = 30;

    public static final Long SIZE_1MB = 1024 * 1024L;

    // ----------------------------密码
    public static final String REGEX_PASSWORD = "^(?=.*\\d)(?=.*[a-zA-Z])[\\da-zA-Z~!@#$%^&*_]{8,}$";

    // ----------------------------视频在线
    public static final String REDIS_KEY_VIDEO_PLAY_COUNT_ONLINE_PREFIX = REDIS_KEY_PREFIX + "video:play:online:";

    public static final String REDIS_KEY_VIDEO_PLAY_COUNT_ONLINE = REDIS_KEY_VIDEO_PLAY_COUNT_ONLINE_PREFIX + "count:%s";

    public static final String REDIS_KEY_VIDEO_PLAY_COUNT_USER_PREFIX = "user:";

    public static final String REDIS_KEY_VIDEO_PLAY_COUNT_USER = REDIS_KEY_VIDEO_PLAY_COUNT_ONLINE_PREFIX + REDIS_KEY_VIDEO_PLAY_COUNT_USER_PREFIX + "%s:%s";
}
